package cc.wubo.jpa;

import org.junit.Before;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import cc.wubo.jpa.entity.User;
import cc.wubo.jpa.repository.UserRepository;
@ComponentScan
@EnableJpaRepositories
@EnableTransactionManagement
public class App {
	
	private UserRepository ur = null;
	@Before
	public void init(){
		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(App.class);
		ur = context.getBean(UserRepository.class);
	}
	@Test
	public void run() {
		
	}
	@Test
	public void save() {
		User user = new User();
		user.setName("wubo");
		ur.save(user);
	}
	

}
